package com.atguigu.spzx.manager.controller;

import com.atguigu.spzx.manager.service.RegionService;
import com.atguigu.spzx.model.common.Result;
import com.atguigu.spzx.model.entity.region.Region;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * title:
 * author: zgl
 * date: 2024/1/4
 * description：
 */
@RestController
@RequestMapping("/admin/base/region")
@Tag(name = "地区管理模块")
public class RegionController {
    @Autowired
    private RegionService regionService;

    @GetMapping("/getRegionByPcode/{parentCode}")
    @Operation(summary = "pcode获取地区信息")
    public Result getRegionByPcode(@PathVariable Long parentCode) {
        List<Region> regionList = regionService.getRegionByPcode(parentCode);
        return Result.ok(regionList);
    }
}
